<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        *
        {
            margin: 0px;
            padding: 0px;

        }

        .container
        {
            width: 400px;
            margin: 0 auto;
        }

        h1
        {
            margin-bottom: 20px;
            text-align: center;
        }

        p
        {
            color: gray;
            margin-bottom: 10px;
            text-align: center;
        }
        
        span
        {
            width: 100px;
            line-height: 40px;
            font-size: 20px;
        }

        /* input
        {
            width: 280px;
            height: 30px;
        } */

        .innerDiv
        {
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .submit
        {
            width: 260px;
            height: 30px;
            background-color: orange;
            border: 0px;
            border-radius: 5px;
        }        

        .submit:active
        {
            background-color: antiquewhite;
        }

        .edit
        {
            width: 240px;
            height: 30px;
        }
        
    </style>
</head>
<body>
    <div class="container">
        <div><h1>表白墙</h1></div>
        <div><p>输入后点击提交，会将信息显示在表格中</p></div>

        <div class="innerDiv">
            <span>谁: </span><input type="text" class="edit">
        </div>
        <div class="innerDiv">
            <span>对谁: </span><input type="text" class="edit">
        </div>
        <div class="innerDiv">
            <span>说: </span><input type="text" class="edit">
        </div>
        <div class="innerDiv">
            <input class="submit" type="button" value="提交" onclick="AddMessage()">
        </div>
    </div>
</body>

<script>
    function AddMessage()
    {
        let edits = document.querySelectorAll(".edit");
        console.dir(edits);
        let message = edits[0].value + " 对 " + edits[1].value + " 说 " + edits[2].value;
        console.log(message);

        let newNode = document.createElement("div");
        newNode.innerHTML = message;
        newNode.className = "innerDiv";
        
        let con = document.querySelector(".container");
        con.appendChild(newNode);
    }
</script>

</html>